#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
int main()
{
	int i = 0, j = 0;
	int temp = 0;
	int arr1[5] = {0};
	int arr2[5] = {0};
	for (i = 0; i < 5; i++)
	{
		scanf("%d", &arr1[i]);
	}
	for (j = 0; j < 5; j++)
	{
		scanf("%d", &arr2[j]);
	}
	while (i < 5 && j < 5)
	{
		arr1[i] = temp;
		temp = arr2[j];
		arr2[j] = arr1[i];
	}
	printf("%d", arr1);
	printf("%d", arr2);
	return 0;
}